package com.aaa.system.dao;

import com.aaa.entity.RoleUser;
import com.aaa.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.aaa.entity.Role;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Lei
 * @create 2023-03-22 18:42
 */
public interface RoleDao extends BaseMapper<Role> {

    @Select("select r.* from sys_role r,sys_role_user ru where r.role_id=ru.role_id and ru.user_id=#{userId}")
    List<Role> getByUerId(Long userId);

    void deleteRole(Long userId);

    void batchInsert(@Param("userId") Long userId,@Param("roleIds") Long[] roleIds);

    void delRoleMenu(Long roleId);

    List<RoleUser> selectUserById(Long roleId);

    boolean batchDelRole(ArrayList okList);
}
